<template>
	<div>

		<!--表格操作项目-->
		<table class="table" cellspacing="0" cellpadding="0">
			<tbody>
				<tr>
					<th>资源名称</th>
					<th>用户</th>
					<th>下载时间</th>
				</tr>
			</tbody>
			<tbody>
				<tr v-for="(item,index) in allResourcesData" :key="index">
					<td>{{item.ziyuan_title}}</td>
					<td>{{item.user.nickname}}</td>
					<td>{{item.update_time}}</td>
				</tr>
			</tbody>
		</table>
		<!-- 分页 -->
		<div class="padding-t-20">
			<a-pagination :pageSize="formCount.pageSize" :current="formCount.page" :total="formCount.count"
				@change="clickPage" :pageSizeOptions="pageSizeOptions" show-size-changer
				@showSizeChange="onShowSizeChange" show-quick-jumper />
		</div>
	</div>
</template>

<script>
	import apiUser from '../../api/resource.js'
	export default {
		data() {
			return {
				// 所有数据
				allResourcesData: [],
				// 分页
				pageSizeOptions: ['20', '50', '100', '150'],
				formCount: {
					count: '',
					page: 1,
					pageSize: 20,
				},
				queryParams: {
					invite_id: '',
					user_name: '',
					phone: '',
					start_time: '',
					end_time: '',
					status: '',
				}
			}
		},
		mounted() {
			this.allResources();
		},
		methods: {
			allResources() {
				apiUser.getDownloadLog(this.formCount.page, this.formCount.pageSize).then((res) => {
					this.allResourcesData = res.result.data;
					this.formCount.count = res.result.count
				})
			},
			// 分页
			clickPage(e) {
				this.formCount.page = e;
				this.allResources();
			},
			onShowSizeChange(current, pageSize) {
				this.formCount.pageSize = pageSize;
				this.formCount.page = 1;
				this.allResources();
			}
		}
	}
</script>

<style>

</style>
